package com.sq.foursm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.sq.foursm.entity.SecUser;
import com.sq.foursm.entity.SecUserExample;
import com.sq.foursm.entity.SecUserExample.Criteria;
import com.sq.foursm.mapper.SecUserMapper;
import com.sq.foursm.service.UserService;

public class UserServicesImpl  implements UserService{

	@Resource
	private SecUserMapper  secUserMapper;
	
	@Override
	public SecUser finduser(String username) throws Exception {
		SecUserExample userExample = new SecUserExample();
				Criteria createCriteria = userExample.createCriteria();
				 createCriteria.andUserNameEqualTo(username);
				 List<SecUser> selectByExample = secUserMapper.selectByExample(userExample);
				 try {
				selectByExample.get(0);
				} catch (Exception e) {
				throw new Exception("没有此用户");
				
				}
				 return selectByExample.get(0);
				 
	}

	
	
	
	
	public SecUserMapper getSecUserMapper() {
		return secUserMapper;
	}

	public void setSecUserMapper(SecUserMapper secUserMapper) {
		this.secUserMapper = secUserMapper;
	}










}
